import React from 'react'
import { useSelector } from 'react-redux';
import { CNavItem } from '@coreui/react'


const adminNav = [
  {
    component: CNavItem,
    name: 'Статистика исследований',
    to: '/statistics',
  },
  {
    component: CNavItem,
    name: 'Сформировать прогноз',
    to: '/forecast',
  },
  {
    component: CNavItem,
    name: 'Факт-прогноз',
    to: '/statistics_forecast',
  },
  {
    component: CNavItem,
    name: 'Почасовой прогноз',
    to: '/hour_forecast',
  },
  {
    component: CNavItem,
    name: 'Сформировать расписание',  
    to: '/schedule',
  },
  {
    component: CNavItem,
    name: 'Расписание по врачам',
    to: '/schedule_of_doctors',
  },
  {
    component: CNavItem,
    name: 'Расписание по модальностям',
    to: '/schedule_of_doctors_by_modality',
  },
]


const doctorNav = [
  {
    component: CNavItem,
    name: 'Статистика исследований',
    to: '/statistics',
  },
];

const hrNav = [
  {
    component: CNavItem,
    name: 'Расписание по модальностям',
    to: '/schedule_of_doctors_by_modality',
  },
];

const bossNav = [
  {
    component: CNavItem,
    name: 'Расписание по модальностям',
    to: '/schedule_of_doctors_by_modality',
  },
];

const Navigation = () => {
  const role = useSelector((state) => state.user.role);

  let _nav;
  switch (role) {
    case 'admin':
      _nav = adminNav;
      break;
    case 'doctor':
      _nav = doctorNav;
      break;
    case 'hr':
      _nav = hrNav;
      break;
    case 'boss':
      _nav = bossNav;
      break;
    default:
      _nav = []; 
  }
  return (
    <aside>
      {_nav.map((item, index) => (
        <CNavItem key={index} to={item.to}>
          {item.name}
        </CNavItem>
      ))}
    </aside>
  );
};


export default Navigation
